<template>
	<view>
		<view class="video-list">
			<view class="video-content" v-for="(item, ind) in details" :key="ind">
				<!-- <view class="video-cover">
					<image :src="item.picUrl" mode="aspectFill"></image>
				</view> -->
				<view class="video-describe">
					<view class="video-tit">
						{{item.typeName}}
					</view>
					<view class="video-reader" v-if="item.order!=null">
						订单号:{{item.order.orderSn}}
					</view>
					<view class="video-reader" v-if="item.order==null&&item.rechargeOrder==null">
						订单号:无
					</view>
					<view class="video-reader" v-if="item.rechargeOrder!=null">
						订单号:{{item.rechargeOrder.orderSn}}
					</view>
					<view class="video-reader" v-if="item.order!=null">
						创建时间:{{dateFormat(item.order.createDatetime)}}
					</view>
					<view class="video-reader" v-if="item.order==null&&item.rechargeOrder==null">
						创建时间:{{dateFormat(item.createDatetime)}}
					</view>
					<view class="video-reader" v-if="item.rechargeOrder!=null">
						创建时间:{{dateFormat(item.rechargeOrder.createDatetime)}}
					</view>
				</view>
				<view style="flex: 1;">
					<view class="integral">
						<!-- 消费 -->
						<text>{{item.integral}}积分</text>
					</view>
				</view>
			</view>
			<view class="video-content"></view>
		</view>
	</view>
</template>
<script>
	import Api from '@/common/api';
	export default {
		components: {

		},
		data() {
			return {
				index: 0,
				details: [],
				memberId: null,
				storeId: null
			}
		},
		onLoad(options) {
			this.memberId = options.memberId
			this.storeId = options.storeId;
			this.getIntegralDetail(options.memberId, options.storeId);
		},
		onShow() {
			// this.getMeals(this.storeId);
		},
		methods: {
			async getIntegralDetail(memberId, storeId) {
				let data = await Api.apiCall('get', Api.qsg.getIntegralDetail, {
					storeId: storeId,
					memberId: memberId
				});
				if (data) {
					console.log(data)
					this.details = data
				}
			},
			dateFormat(time) {
				let date = new Date(time);
				let year = date.getFullYear();
				// 在日期格式中，月份是从0开始的，因此要加0，使用三元表达式在小于10的前面加0，以达到格式统一  如 09:11:05
				let month = date.getMonth() + 1 < 10 ? "0" + (date.getMonth() + 1) : date.getMonth() + 1;
				let day = date.getDate() < 10 ? "0" + date.getDate() : date.getDate();
				let hours = date.getHours() < 10 ? "0" + date.getHours() : date.getHours();
				let minutes = date.getMinutes() < 10 ? "0" + date.getMinutes() : date.getMinutes();
				let seconds = date.getSeconds() < 10 ? "0" + date.getSeconds() : date.getSeconds();
				// 拼接
				// return year + "-" + month + "-" + day + " " + hours + ":" + minutes + ":" + seconds;
				return year + "-" + month + "-" + day + " " + hours + ":" + minutes;
			},
		}
	}
</script>

<style>
	.doubleButton {
		width: 750rpx;
		height: 100rpx;
		position: fixed;
		bottom: 0;
		right: 0;
		background: #FFFFFF;
		box-shadow: 0 0 20rpx #b4beef;
		display: flex;
	}

	.doubleButton button:first-child {
		height: 100rpx;
		line-height: 100rpx;
		flex: 1.5;
		border-radius: 0;
		font-size: 30rpx;
		text-align: center;
		background: #fff;
		color: #222;
	}
	
	.integral {
		margin-top: 25%;
		font-size: 30rpx;
		color: #00aaff;
		font-weight: 500;
	}

	.priceSign {
		font-size: 24rpx;
	}

	.priceNum {
		font-size: 32rpx;
		font-weight: bold;
	}

	.priceIcon {
		font-size: 24rpx;
	}

	.schoolName {
		width: 750rpx;
		padding: 0 30rpx;
		box-sizing: border-box;
		font-size: 50rpx;
		font-weight: bold;
		color: #000000;
	}

	.uni-input {
		padding: 0 24rpx;
	}

	.choese {
		width: 750rpx;
		display: flex;
		box-sizing: border-box;
		padding: 0 30rpx;
		color: #888888;
	}

	.dataName {
		height: 60rpx;
	}

	.currentSchool {
		height: 60rpx;
		background: #FFFFFF;
	}

	.video-tit {
		letter-spacing: 4rpx;
		font-size: 30rpx;
		color: #00aaff;
		font-weight: bold;
		display: inline-block;
		vertical-align: top;
		overflow: hidden;
		text-overflow: ellipsis;
		display: -webkit-box;
		-webkit-line-clamp: 2;
		-webkit-box-orient: vertical;
	}

	.checkMore text {
		display: block;
		width: 100%;
		height: 60rpx;
		line-height: 58rpx;
		font-size: 24rpx;
		color: #172a89;
		border: 1px solid #172A89;
		text-align: center;
		box-sizing: border-box;
		margin-top: 36rpx;
		border-radius: 50rpx;
		letter-spacing: 5rpx;
	}

	.checkMore {
		font-size: 24rpx;
		color: #172a89;
		flex: 1;
	}

	.video-price {
		font-size: 30rpx;
		color: #666;
		overflow: hidden;
		display: inline-block;
		vertical-align: top;
		text-align: center;
		box-sizing: border-box;
	}

	.video-reader {
		font-size: 24rpx;
		color: #666;
		letter-spacing: 5rpx;
	}

	.video-describe {
		flex: 3;
		display: inline-block;
		vertical-align: top;
	}

	.video-cover {
		width: 100rpx;
		height: 100rpx;
		margin: 30rpx 30rpx 30rpx 0;
		display: inline-block;
		vertical-align: top;
		border-radius: 50%;
		flex: 1;
	}

	.video-cover image {
		width: 100rpx;
		height: 100rpx;
		background: #FFFFFF;
		border-radius: 50%;
	}

	.video-content {
		width: 690rpx;
		padding: 22rpx 0;
		border-bottom: 1rpx solid #e6e6e6;
		box-sizing: border-box;
		display: flex;
	}

	.video-content:last-child {
		border: none;
	}

	.video-list {
		width: 750rpx;
		height: auto;
		padding: 0 30rpx;
		box-sizing: border-box;
	}
</style>
